﻿using SIAKAD.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SIAKAD
{
    public partial class Admin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckSession();
        }

        private void CheckSession()
        {
            if (Session["siakad"] != null && Session["siakad"] is SIAKADCORE.Models.Login)
            {
                if ((Session["siakad"] as SIAKADCORE.Models.Login).UserType != SIAKADCORE.Models.LoginType.Admin)
                {
                    Response.Redirect(SiteMapHelper.Check((Session["siakad"] as SIAKADCORE.Models.Login)));
                }
            }
            else
            {
                Response.Redirect("/Login.aspx");
            }
        }
    }
}